<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    
 <head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="css/adminstyle.css" rel="stylesheet" type="text/css">
<link rel="stylesheet" href="css/common.css" type="text/css" />
<link href="css/ui-lightness/jquery-ui-1.10.3.custom.min.css" rel="stylesheet" type="text/css">
<script  language="javascript" type="text/javascript" src="js/jquery-1.9.1.min.js"></script>
<script   language="javascript" type="text/javascript"src="js/jquery-ui-1.10.3.custom.js"></script>
<title><?=Common::_t('page_admin_area')?></title>
</head>
<script>
$(function() {		
	$( "#tabs" ).tabs();
});
</script>
<body>
<?$page_th = Common::_t('page_th');?>
<div id="man_zone">
<div id="tabs">
	<ul>
		<li><a href="#tabs-3"><?=getStr($page_th, 'operator_log')?></a></li>
		<li><a href="#tabs-1"><?=getStr($page_th, 'class_info')?></a></li>
      <?if($_SESSION['admin']['admin_type']==ADMIN_TYPE_EMPLOYEE){ ?>
		<li><a href="#tabs-2"><?=getStr($page_th, 'pay_info')?></a></li>
	  <?}?> 	
</ul>
<div style="background-color:#FFFFFF ">
  <?if($_SESSION['admin']['admin_type']==ADMIN_TYPE_EMPLOYEE){ ?>
<div id="tabs-2">
  <table width="100%" border="0" align="center"  cellpadding="3" cellspacing="1" class="tableborder">
        <tr  class="header">
          <td colspan="8" ><?=getStr($page_th, 'pay_info')?></td>
        </tr>
        <tr  bgcolor="#FFFFFF">
          <td  style="font-weight:bold;width:10%" ><?=getStr($page_th, 'order_sn')?></td>
          <td  style="width:20%"><?=$book['book_no']?></td>
          <td  style="font-weight:bold;width:15%" ><?=getStr($page_th, 'pay_status')?></td>
          <td  style="width:15%"><?=$book['pay_status']?></td>
          <td  style="font-weight:bold;width:10%" ><?=getStr($page_th, 'pay_class')?></td>
          <td style="width:10%"><?=$book['pay_userclass']?></td>
          <td  style="font-weight:bold;width:10%;" ><?=getStr($page_th, 'need_class')?></td>
          <td  style="width:1o%"><?=$book['course_needclass']?></td>
      </tr>
 </table>  
</div>
<?}?>
<div  id="tabs-1">  
    <table width="99%" border="0" align="center"  cellpadding="3" cellspacing="1" class="tableborder">   
        <tr class="header">
          <td colspan="8"><?=getStr($page_th, 'class_info')?></td>
        </tr>
        <tr  bgcolor="#FFFFFF">
          <td style="font-weight:bold;width:10%;" align="center"><?=getStr($page_th, 'class_title')?></td>
          <td style="width:20%;">
          	<span class="span_detail"><?=getStr($page_th, 'book_type')?>：<?=$book['book_type_name']?>&nbsp;</span><br>
          	<br>
          	<span class="span_detail"><?=getStr($page_th, 'class_time')?>：<?=$book['book_time']?></span><br>
          	<br>
          	<span ><?=getStr($page_th, 'class_tool')?>：<?=$book['communication_tools_name']?></span></td>
          <td style="font-weight:bold;" align="center"><?=getStr($page_th, 'book_status')?></td>
		  <td><?=$book['class_status_name']?></td>
          <td style="font-weight:bold;" align="center">
          	<?=getStr($page_th, 'teacher_status')?>
          </td>
          <td><?=$book['teacher_status_name']?></td>          
          <td style="font-weight:bold;" align="center"><?=getStr($page_th, 'student_status')?></td>
          <td><?=$book['user_status_name']?></td>
      </tr>
      <tr  bgcolor="#FFFFFF">
      <td colspan="8">&nbsp;
      
      </td>
      </tr>      
        <tr  bgcolor="#FFFFFF">
          <td style="font-weight:bold;width:10%;" align="center"><?=getStr($page_th, 'course_info')?></td>
          <td >
          <span class="span_detail"><?=getStr($page_th, 'course_title')?>:<?=$course['theme']?>&nbsp;</span><br>
          <span class="span_detail"><?=getStr($page_th, 'course_no')?>:<?=$course['serial_number']?>&nbsp;</span><br>
          </td>
          <td style="font-weight:bold;" align="center"><?=getStr($page_th, 'course_type')?></td>
          <td><?=$course['type_name']?></td>
          <td style="font-weight:bold;" align="center"><?=getStr($page_th, 'chapter_info')?></td>
          <td>
          <?if($course['type']!=COURSE_TYPE_SPECIAL){?>
          <span class="span_detail">
          <?=getStr($page_th, 'chapter_no')?>:<?=$book['chapter_no']?>&nbsp;</span><br>
          <span class="span_detail"><?=getStr($page_th, 'chapter_title')?>:<?=getLangStr($book['chapter_name'],$_SESSION['admin']['default_lang'])?>&nbsp;</span><br>
          <?}?>
          </td>
          <td style="font-weight:bold;" align="center"><?=getStr($page_th, 'course_download')?></td>
		  <td>
		  <?if($course['type']!=COURSE_TYPE_SPECIAL){?>
		  <a href="chapter_download.html<?=$book['download_filename']?>?id=<?=$book['chapter_id']?>" target="_blank"><font color="blue"><?=getStr($page_th, 'course_download')?></font></a>
		  <?}?>
		  </td>
      </tr>
      <tr  bgcolor="#FFFFFF">
      <td colspan="8">&nbsp;
      
      </td>
      </tr>
       <tr bgcolor="#FFFFFF">
          <td style="font-weight:bold;" align="center"><?=getStr($page_th, 'student_title')?></td>
          <td><span  class="span_detail"><?=getStr($page_th, 'student_name')?>：<?=$book['english_name']?>
          </span>
          <br>
          <br>
          <span  class="span_detail"><?=getStr($page_th, 'student_phone')?>：<?=$book['phone']?></span>
          <br>
          <br>
          <? if($book['communication_tools']==QQ){?>
          <span class="span_detail">QQ：<?=$book['qq']?></span>
          <? } ?>
          <? if($book['communication_tools']==SKYPE){?>
          <span class="span_detail">SKYPE：<?=$book['skype_id']?></span>
          <?}?>
          <br>
          <br>
          <span class="span_detail"><?=getStr($page_th, 'student_job')?>：<?=getStr($user['user_job_pair'],$user['job'])?></span>
          <br>
          <br>
          <span><?=getStr($page_th, 'student_level')?>：<?=getStr($user['level_pair'],$user['level'])?></span>
          </td>
          <td style="font-weight:bold;" align="center"><?=getStr($page_th, 'student_follower')?></td>
          <td ><?=$user['employee_name']?></td>                    
          <td style="font-weight:bold;" align="center"><?=getStr($page_th, 'student_message')?></td>
          <td colspan="5"><?=$book['message']?></td>                    
        </tr>
      <tr  bgcolor="#FFFFFF">
      <td colspan="8">&nbsp;
      
      </td>
      </tr>        
        <tr bgcolor="#FFFFFF">
          <td style="font-weight:bold;" align="center"><?=getStr($page_th, 'teacher_title')?></td>
          <td ><br><span  class="span_detail"><?=getStr($page_th, 'teacher_name')?>：<?=$teacher['name']?></span><br><br>
          <? if($book['communication_tools']==QQ){?>
          <span >QQ：<?=$teacher['qq']?></span>
          <? } ?>
          <? if($book['communication_tools']==SKYPE){?>
          <span >SKYPE：<?=$teacher['skype']?></span>
          <? }?>
          <br>
          <br>
          </td>
          <td style="font-weight:bold;" align="center"><?=getStr($page_th, 'teacher_follower')?></td>
          <td ><?=$teacher['employee_name']?></td>
          <td style="font-weight:bold;" align="center"><?=getStr($page_th, 'teacher_service')?></td>
          <td><?=$teacher['email']?></td>
          <td style="font-weight:bold;" align="center"><?=getStr($page_th, 'teacher_level')?></td>
          <td><?=getStr($user['level_pair'],$teacher['teach_level'])?></td>          
        </tr>
      <tr  bgcolor="#FFFFFF">
      <td colspan="8">&nbsp;
      
      </td>
      </tr>        
</table>
          </td>
        </tr>
     
  </table>
</div>
<div id="tabs-3">
  <form method="post" id="form" action="" >
 <table width="96%" border="0" cellpadding="3" cellspacing="1" class="tableborder" align="center">
         <tr  class="header">
          <td colspan="6" ><?=Common::_t('page_operation')?></td>
        </tr>      
		<tr bgcolor="#FFFFFF" id="tr_substitute">
			
          <td style="font-weight:bold; width:10%;" align="center" ><?=getStr($page_th, 'class_set')?></td>
          <td style="width:20%;" colspan="1">
          <?if ($book['class_status']==CLASS_STATUS_2){?>
          <?=$book['teacher_substitute_list'][$book['teacher_substitute']]?>
           <input type="hidden" name="substitute" id="substitute" value="<?=$book['teacher_substitute']?>">
          <?}else{?>
          <?=page_modifier_radios('substitute',$book['teacher_substitute_list'],$book['teacher_substitute'])?>
          <?}?>
          </td>          
          <td style="font-weight:bold; width:10%;" align="center" ><?=getStr($page_th, 'teacher_set')?></td>
          <td style="width:20%;"  colspan="1">
          <input type="hidden" name="original_teacher_id" id="original_teacher_id" value="<?=$book['original_teacher_id']?>">
          <input type="hidden" name="old_teacher_id" id="old_teacher_id" value="<?=$book['old_teacher_id']?>">
          <input type="hidden" name="old_teacher_name" id="old_teacher_name" value="<?=$book['old_teacher_name']?>">
          <input type="hidden" name="old_class_status" id="old_class_status" value="<?=$book['class_status']?>">
            <?if ($book['class_status']==CLASS_STATUS_2){?>
		          <?=$book['substitue_teacher_pair'][$book['teacher_id']]?>
		          <input type="hidden" name="teacher_id" id="teacher_id" value="<?=$book['teacher_id']?>">
          <?}else{?>
	          <select id="teacher_id" name="teacher_id">
	             <?=page_modifier_options($book['substitue_teacher_pair'],$book['teacher_id'])?>
	          </select>
           <?}?>
          &nbsp;
          </td>          
          <td style="font-weight:bold; width:10%;" align="center" ><?=getStr($page_th, 'take_over_info')?></td>
          <td style="width:20%;"  colspan="1">
          <span id="old_teacher_info">&nbsp;</span><br>
          <span>-------------------------------------------------</span><br>
          <span id ="new_teacher_info">&nbsp;</span>
          &nbsp;
          </td>          
		</tr> 	        
		<tr bgcolor="#FFFFFF">
          <td style="font-weight:bold; width:10%;" align="center" ><?=getStr($page_th, 'teacher_report_status')?></td>
          <td style="width:20%;">
          <?=page_modifier_radios('report_status',$book['teacher_report_status_list'],$book['teacher_report_status'])?>
          </td>          
          <td style="font-weight:bold; width:10%;" align="center" ><?=getStr($page_th, 'teacher_status')?></td>
          <td style="width:20%;">
          <?=page_modifier_radios('teacher_status',$book['teacher_status_list'],$book['teacher_status'])?>
          </td>          
          <td style="font-weight:bold;width:10%;" align="center"><?=getStr($page_th, 'student_status')?></td>
          <td style="width:20%;" align="left">
          <?=page_modifier_radios('user_status',$book['user_status_list'],$book['user_status'])?>
          </td>
		</tr>     
		<tr bgcolor="#FFFFFF">
          <td colspan="1" ><?=getStr($page_th, 'operation_content')?></td>
          <td colspan="5" ><textarea name="remark" id="textfield" cols="50" rows="5"></textarea></td>		
		</tr>	
		<tr>
		<td colspan="6" bgcolor="#FFFFFF">&nbsp;</td>
		</tr>
		<tr bgcolor="#FFFFFF">
          <td style="font-weight:bold;width:15%;" align="center"><?=getStr($page_th, 'book_status')?></td>
		  <td style="width:10%;" colspan="2"><?=$book['class_status_name']?></td>
		  <td style="font-weight:bold;" align="center"><?=getStr($page_th, 'operation_info')?></td>
		  <td style="width:15%;"  colspan="2">
		  <? if ($book['class_status']==CLASS_STATUS_0){?>
		  <?=$book['add_user']?>&nbsp;&nbsp;<?=getStr($page_th, 'operation_action_add')?>
		  <?=date('Y-m-d H:i:s',$book['add_time'])?>
		  <? }?>
		  <? if ($book['class_status']==CLASS_STATUS_1){?>
		  <?=$book['confirm_admin']?>&nbsp;&nbsp;<?=getStr($page_th, 'operation_action_confirm')?>
		  <?=date('Y-m-d H:i:s',$book['confirm_time'])?>
		  <?}?>
		  <?if ($book['class_status']==CLASS_STATUS_2){?>
		  <?=$book['complete_admin']?>&nbsp;&nbsp;<?=getStr($page_th, 'operation_action_complete')?>
		  <?=date('Y-m-d H:i:s',$book['complete_time'])?>
		  <?}?>
		  <?if ($book['class_status']==CLASS_STATUS_3){?>
		  <?=$book['cancel_admin']?>&nbsp;&nbsp;<?=getStr($page_th, 'operation_action_cancel')?>
		  <?=date('Y-m-d H:i:s',$book['cancel_time'])?>
		  <?}?>
		  </td>
		</tr>
		<tr>
		<td colspan="6" bgcolor="#FFFFFF">&nbsp;</td>
		</tr>
		<tr   bgcolor="#FFFFFF">
          <td colspan="6" >
	       <input name="id" type="hidden" value="<?=$book['id']?>" />
	       <?if($_SESSION['admin']['admin_type']==ADMIN_TYPE_TEACHER){ ?>
       	    <input name="" type="button" value="<?=Common::_t('page_back')?>" class="PublicBot" onclick="location.href='BookCourse_teacherGetList.html'" />
       	   <?}else{?>
       	    <input name="" type="button" value="<?=Common::_t('page_back')?>" class="PublicBot" onclick="location.href='BookCourse_lists.html'" />
       	   <?}?> 
           	<?if($book['class_status']!=CLASS_STATUS_3){?>
	          	<input name="" type="button" value="<?=Common::_t('page_save')?>" class="PublicBot" onclick="subs('BookCourse_saveRemark.html')" />
	           	<input name="" type="button" class="PublicBot" value="<?=Common::_t('page_complete')?>"  onclick="subs('BookCourse_complete.html')" />
	           	<?if($book['class_status']==CLASS_STATUS_0){?>
	            <input name="" type="button" class="PublicBot" value="<?=Common::_t('page_cancel')?>"  onclick="subs('BookCourse_cancellation.html')" />
	            <?}?>
            <?}?>
          </td>
        </tr>
 		 	<tr  bgcolor="#FFFFFF">
   			 <td style="width:15%" colspan="1"><?=getStr($page_th, 'operation_type')?></td>
   			 <td style="width:15%" colspan="1"><?=getStr($page_th, 'operation_user')?></td>
   			 <td style="width:15%"  colspan="2"><?=getStr($page_th, 'operation_time')?></td>
   		 	<td style="width:55%"  colspan="2"><?=getStr($page_th, 'operation_content')?></td>
  			</tr>
		  <?
		  foreach($log as $v){
		  ?>
		    <tr  bgcolor="#FFFFFF">
		    <td colspan="1"><?=$v['type']?></td>
		    <td colspan="1"><?=$v['add_admin']?></td>
		    <td colspan="2"><?=date('Y-m-d H:i:s',$v['add_time'])?></td>
		    <td colspan="2"><?=$v['remark']?></td>
		  </tr>
		  <?
		  }
		  ?>        
 </table>
</form> 
</div>  
</div>
</div>
</div>
<?$page_message = Common::_t('page_message');
?>
<?$page_th_js = Common::_t('page_th_js');
?>
<script>
$("#teacher_id").change(function(){//改变的时候才Post
	var old_class_status =$("#old_class_status").val();
	var substitute =1;
	if(old_class_status=='2'){
		substitute = $("#substitute").val();
	}else{
		substitute = $("input[name='substitute']:checked").val();
	}
	var old_teacher_id=$("#old_teacher_id").val();
	var teacher_id = $("#teacher_id").val();
	//代课方面
	if(substitute=='2'||substitute=='3'){
		if(old_teacher_id==teacher_id){//老师不变不对
			alert('<?=getStr($page_message, 'page_message_1')?>');
			return;
		}else{
			var old_teacher_info = '<?=getStr($page_th_js, 'page_th_js_1')?>:'+$("#old_teacher_name").val();
			var new_teacher_info = $("#teacher_id").find("option:selected").text();  ;
			$('#old_teacher_info').html(old_teacher_info);	
			$('#new_teacher_info').html(new_teacher_info);	
		}
	}
	else{//正常授课
		//old_teacher_id必须等于teacher_id
		if(old_teacher_id==teacher_id){//恢复上课老师
			var old_teacher_info = '<?=getStr($page_th_js, 'page_th_js_1')?>:'+$("#old_teacher_name").val();
			var new_teacher_info = '<?=getStr($page_th_js, 'page_th_js_2')?>';
			$('#old_teacher_info').html(old_teacher_info);	
			$('#new_teacher_info').html(new_teacher_info);	
		}else{
			alert('<?=getStr($page_message, 'page_message_2')?>');	
			return;
		}
	}
})		

$("input[type='radio']").change(function(){
	var old_class_status =$("#old_class_status").val();
	var substitute =1;
	if(old_class_status=='2'){
		substitute = $("#substitute").val();
	}else{
		substitute = $("input[name='substitute']:checked").val();
	}
	var old_teacher_id=$("#old_teacher_id").val();
	var teacher_id = $("#teacher_id").val();
	//代课方面
	if(substitute=='2'||substitute=='3'){
		if(old_teacher_id==teacher_id){//老师不变不对
			alert('<?=getStr($page_message, 'page_message_3')?>');
			return;
		}
	}else{//正常授课
		//old_teacher_id必须等于teacher_id
		if(old_teacher_id!=teacher_id){
			alert('<?=getStr($page_message, 'page_message_4')?>');
			return;
		}
	}

	var report_status = $("input[name='report_status']:checked").val();
	var teacher_status = $("input[name='teacher_status']:checked").val();
	if(report_status==3){//临时完全缺席,来不及换老师
		if(teacher_status==2){
			$("input[name='teacher_status'][value='1']").attr("checked",true); 
			alert('<?=getStr($page_message, 'page_message_5')?>');
			return;
		}
	}
})
		  
function subs(value){
	var old_class_status =$("#old_class_status").val();
	var substitute =1;
	if(old_class_status=='2'){
		substitute = $("#substitute").val();
	}else{
		substitute = $("input[name='substitute']:checked").val();
	}
	var old_teacher_id=$("#old_teacher_id").val();
	var teacher_id = $("#teacher_id").val();
	//代课方面
	if(substitute=='2'||substitute=='3'){
		if(old_teacher_id==teacher_id){//老师不变不对
			alert('<?=getStr($page_message, 'page_message_6')?>');
			return;
		}
	}else{//正常授课
		//old_teacher_id必须等于teacher_id
		if(old_teacher_id!=teacher_id){
			alert('<?=getStr($page_message, 'page_message_3')?>');
			return;
		}
	}

	var report_status = $("input[name='report_status']:checked").val();
	var teacher_status = $("input[name='teacher_status']:checked").val();
	if(report_status==3){//临时完全缺席,来不及换老师
		if(teacher_status==2){
			$("input[name='teacher_status'][value='1']").attr("checked",true); 
			alert('<?=getStr($page_message, 'page_message_7')?>');
			return;
		}
	}
	document.getElementById('form').action=value;
	document.getElementById('form').submit();
}
</script>
</body>
</html>